<HTML dir="ltr">
	<HEAD>
		<TITLE>'3ds max Plugin Wizard'</TITLE>
		<META content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<LINK ID="LINKURL" REL="stylesheet" HREF="../../1033/styles.css">
		<STYLE type="text/css">@import url(); 
		</STYLE>
		</HEAD>
	<BODY onkeypress="OnPress();" onkeydown="OnKey();" bottomMargin="0" bgColor="buttonface" leftMargin="0" topMargin="0" onload="InitDocument(document);SetEnabled();" rightMargin="0">
		<TABLE class="ONE" height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
			<COLGROUP>
				<COL width="178">
				<COL>
				<!--OPEN OF INTRODUCTORY INFORMATION TABLE//-->
				<TR vAlign="top">
					<TD width="100%" colSpan="2" height="79">
						<TABLE class="TWO" cellSpacing="0" cellPadding="0" border="0">
							<COLGROUP>
								<COL width="12">
								<COL>
								<COL width="12">
								<TR>
									<TD vAlign="top" width="12" height="12">&nbsp;
									</TD>
									<TD vAlign="top" height="12">&nbsp;
									</TD>
									<TD vAlign="top" width="12" height="12">&nbsp;
									</TD>
									<TD class="IMAGE" vAlign="bottom" width="110" rowSpan="2">
										<DIV class="SMALLA" id="Layer0"><IMG class="SMALLEST" height="63" alt="" src="..\..\Images\3dsmaxPluginWizard.gif" width="63" border="0">
										</DIV>
									</TD>
									<TD vAlign="top" width="6" height="12" rowSpan="2">&nbsp;
									</TD>
								</TR>
								<TR>
									<TD vAlign="top" width="12" height="65">&nbsp;
									</TD>
									<TD vAlign="top" height="65">
										<H4 class="HEAD" id="HEAD">Welcome to the 3ds max Plugin Wizard.</H4>
										<P class="SUBHEAD" id="SUBHEAD">Please complete the project settings below and 
											click Finish to generate&nbsp; the project.</P>
									</TD>
									<TD vAlign="top" width="12" height="65">&nbsp;
									</TD>
								</TR>
								<TR>
									<TD class="RULE" vAlign="top" colSpan="5" height="2">
										<TABLE height="1" cellSpacing="0" cellPadding="0" width="100%" border="0">
											<TR vAlign="top">
												<TD width="100%" bgColor="buttonshadow" height="1"><IMG height="1" alt="" src="../../Images/spacer.gif" width="1"></TD>
												<TD width="1" bgColor="window" height="1"><IMG height="1" alt="" src="../../Images/spacer.gif" width="1"></TD>
											</TR>
										</TABLE>
									</TD>
								</TR>
						</TABLE>
					</TD>
				</TR>
				<!--CLOSE OF INTRODUCTORY INFORMATION TABLE//-->
				<!--OPEN OF NAVIGATION, CONTENT, AND BUTTON TABLES//-->
				<TR vAlign="top">
					<TD class="THREE" style="BACKGROUND-IMAGE: url(..\..\Images\3dsmaxPluginWizard_BG.gif)" vAlign="top" width="178" height="100%">
						<!--OPEN OF NAVIGATION TABLE//-->
						<TABLE class="THREE" cellSpacing="0" cellPadding="0" border="0">
							<COLGROUP>
								<COL width="12">
								<COL width="166">
								<COL width="1">
								<TR>
									<TD vAlign="top" colSpan="3" height="12">&nbsp;
									</TD>
								</TR>
								<TR>
									<TD vAlign="top" width="12" height="100%">&nbsp;
									</TD>
									<TD vAlign="top" width="165" height="100%">
										<!--OPEN OF NAVIGATIONAL LINKS//-->
										<DIV class="LINK">
											<TABLE class="LINKTEXT" height="28" cellSpacing="0" cellPadding="0" width="166" border="0">
												<TR vAlign="center">
													<TD width="162"><SPAN class="ACTIVELINK" id="Default" title="" onclick="Next(document, 'default.htm');" tabIndex="1"><font color="#eeeeee">Plugin 
																Type</font></SPAN>
													</TD>
													<TD width="4"><IMG height="1" src="../../Images/spacer.gif" width="4">
													</TD>
												</TR>
											</TABLE>
										</DIV>
										<DIV class="LINK">
											<TABLE class="LINKTEXT" height="28" cellSpacing="0" cellPadding="0" width="166" border="0">
												<TR vAlign="center">
													<TD width="162"><SPAN class="ACTIVELINK" id="Page_2" title="" onclick="Next(document, 'Page_2.htm');" tabIndex="1"><font color="#eeeeee">Plugin 
																Details</font></SPAN>
													</TD>
													<TD width="4"><IMG height="1" src="../../Images/spacer.gif" width="4">
													</TD>
												</TR>
											</TABLE>
										</DIV>
										<DIV class="LINKSELECTED"><SPAN class="VERTLINE1"><IMG height="1" alt="" src="../../Images/spacer.gif" width="1" border="0">
											</SPAN><SPAN class="HORILINE1">
												<TABLE height="100%" cellSpacing="0" cellPadding="0" width="167" border="0">
													<TR vAlign="top">
														<TD class="DOTTEDLINE" height="1"></TD>
													</TR>
													<TR vAlign="top">
														<TD height="100%"><IMG height="28" alt="" src="../../Images/spacer.gif" width="1" border="0">
														</TD>
													</TR>
													<TR vAlign="top">
														<TD class="DOTTEDLINE" height="1"></TD>
													</TR>
												</TABLE>
											</SPAN>
											<TABLE class="LINKTEXT" height="28" cellSpacing="0" cellPadding="0" width="160" border="0">
												<TR vAlign="center">
													<TD width="162">
														<B>
															<SPAN id="Page_3" title="" onclick="Next(document, 'Page_3.htm');" tabIndex="1">Project Details
															</SPAN>
														</B>
													</TD>
													<TD WIDTH="4"><IMG height="1" src="../../Images/spacer.gif" width="4">
													</TD>
												</TR>
											</TABLE>
										</DIV>
										<!--CLOSE OF NAVIGATIONAL LINKS//--></TD>
									<TD width="1">
										<DIV CLASS="VERTLINE"><IMG height="1" alt="" src="../../Images/spacer.gif" width="1" border="0">
										</DIV>
									</TD>
								</TR>
						</TABLE>
						<!--CLOSE OF NAVIGATION TABLE//--></TD>
					<TD vAlign="top" height="100%">
						<!--OPEN OF CONTENT AND BUTTON TABLE//-->
						<TABLE class="ONE" cellSpacing="0" cellPadding="0" border="0">
							<COLGROUP>
								<COL width="100%">
								<TR VALIGN="top">
									<TD style="WIDTH: 118.74%" height="100%">
										<!--OPEN OF CONTENT//-->
										<TABLE class="CONTENT" id="Table1" cellSpacing="0" cellPadding="0" border="0">
											<COLGROUP>
												<COL width="12">
												<COL width="185">
												<COL width="12">
												<COL width="185">
												<COL width="12">
												<COL width="185">
												<COL width="12">
												<TR>
													<TD vAlign="top" colSpan="5" height="12">&nbsp;
													</TD>
												</TR>
												<TR vAlign="top">
													<TD vAlign="top" width="12">&nbsp;
													</TD>
													<TD style="WIDTH: 281px" vAlign="top" colSpan="3">
														<P class="ElementSpacer">&nbsp;</P>
														<SPAN class="itemText"><LABEL id="AUT_ID5" title="Sample list box." for="PLUGTYPE_LISTBOX">
															</LABEL>Enter your MAXSDK path:<BR>
															<INPUT id="MAXSDKPATH_TEXTBOX" style="WIDTH: 200px" type="text" name="MAXSDKPATH_TEXTBOX">
															<INPUT id="MAXSDKPATH_BUTTON" style="WIDTH: 25px; HEIGHT: 20px" onclick="GetDirectory(MAXSDKPATH_TEXTBOX, '3ds max SDK ');" type="button" value="..." name="MAXSDKPATH_BUTTON">
															<BR>
															<BR>
															Enter your Plugin output path:<BR>
															<INPUT id="PLUGPATH_TEXTBOX" style="WIDTH: 200px" type="text" name="PLUGPATH_TEXTBOX">
															<INPUT id="PLUGPATH_BUTTON" style="WIDTH: 25px; HEIGHT: 20px" onclick="GetDirectory(PLUGPATH_TEXTBOX, '3ds max Plugins');" type="button" value="..." name="PLUGPATH_BUTTON"><BR>
															<BR>
															Enter your 3dsmax.exe path:<BR>
															<INPUT id="EXEPATH_TEXTBOX" style="WIDTH: 200px" type="text" name="EXEPATH_TEXTBOX">
															<INPUT id="EXEPATH_BUTTON" style="WIDTH: 25px; HEIGHT: 20px" onclick="GetDirectory(EXEPATH_TEXTBOX, '3ds max');" type="button" value="..." name="EXEPATH_BUTTON"><BR>
															<BR>
															<INPUT id="PARAMMAP_CHECKBOX" type="checkbox" name="PARAMMAP_CHECKBOX">&nbsp;Implement 
															Parameter Maps<BR>
															<BR>
															<INPUT id="EXTCHANNEL_CHECKBOX" type="checkbox" name="EXTCHANNEL_CHECKBOX">&nbsp;Implement 
															Extension Channels<BR>
															&nbsp; </SPAN>
													</TD>
													<TD vAlign="top" width="12">&nbsp;
													</TD>
												</TR>
												<TR>
													<TD vAlign="top" colSpan="7" height="100%">&nbsp;
													</TD>
												</TR>
										</TABLE>
										<!--CLOSE OF CONTENT//--></TD>
								</TR>
								<TR VALIGN="bottom">
									<TD style="WIDTH: 118.74%" height="48">
										<!--OPEN OF BUTTON HTML//-->
										<TABLE height="48" cellSpacing="0" cellPadding="0" border="0">
											<COLGROUP>
												<COL width="12">
												<COL>
												<COL width="75">
												<COL width="4">
												<COL width="75">
												<COL width="4">
												<COL width="75">
												<COL width="12">
												<TR>
													<TD class="RULE" vAlign="top" colSpan="8" height="2">
														<TABLE height="1" cellSpacing="0" cellPadding="0" width="100%" border="0">
															<TR vAlign="top">
																<TD width="100%" bgColor="buttonshadow" height="1"><IMG height="1" alt="" src="../../Images/spacer.gif" width="1"></TD>
																<TD width="1" bgColor="window" height="1"><IMG height="1" alt="" src="../../Images/spacer.gif" width="1"></TD>
															</TR>
														</TABLE>
													</TD>
												</TR>
												<TR>
													<TD vAlign="top" colSpan="8" height="11">&nbsp;
													</TD>
												</TR>
												<TR>
													<TD vAlign="center" width="12" height="23">&nbsp;
													</TD>
													<TD vAlign="top" height="23">&nbsp;
													</TD>
													<TD vAlign="center" width="75" height="23"><BUTTON class="BUTTONS" id="FinishBtn" accessKey="F" onclick="OnFinish(document);" type="button"><U>F</U>inish</BUTTON>
													</TD>
													<TD vAlign="center" width="4" height="23">&nbsp;
													</TD>
													<TD vAlign="center" width="75" height="23"><BUTTON class="BUTTONS" id="CancelBtn" accessKey="C" onclick="window.external.Finish(document, 'cancel');" type="button"><U>C</U>ancel</BUTTON>
													</TD>
													<TD vAlign="center" width="4" height="23">&nbsp;
													</TD>
													<TD vAlign="center" width="75" height="23"><BUTTON class="BUTTONS" id="HelpBtn" accessKey="H" onclick="window.external.OnHelp('vc.appwiz.custom.overview');" type="button"><U>H</U>elp</BUTTON>
													</TD>
													<TD vAlign="center" width="12" height="23">&nbsp;
													</TD>
												</TR>
												<TR>
													<TD VALIGN="top" HEIGHT="12" COLSPAN="8">
														&nbsp;
													</TD>
												</TR>
										</TABLE>
										<!--CLOSE OF BUTTON HTML//--></TD>
								</TR>
						</TABLE>
						<!--CLOSE OF NAVIGATION, CONTENT, AND BUTTON TABLES//--></TD>
				</TR>
		</TABLE>
	</BODY>
</HTML>

<SCRIPT language="JSCRIPT">

var tab_array = new Array();
tab_array[0] = Default;
tab_array[1] = Page_2;
tab_array[2] = Page_3;

// Init ini path.
var iniPath = window.external.FindSymbol("START_PATH") + '\\' + '3dsmaxPluginWizard.ini';

function GetDirectory(textBox, mssString)
{
	  var bBrowseDlg = true;
      try
      {
         var strDirectory = window.external.GetDirectoryViaBrowseDlg("Choose " + mssString + " Directory", "C:\\");
         if (strDirectory != "")
         {
            if (strDirectory.charAt(strDirectory.length-1)=='\\')
            {
               if (strDirectory.charAt(strDirectory.length-2) != ':')
                  strDirectory = strDirectory.substring(0, strDirectory.length-1);
            }
            
            //ISAPI_DIRECTORY.value = strDirectory;
            //alert(strDirectory);
            textBox.value = strDirectory;
            //window.external.AddSymbol("ISAPI_DIRECTORY", strDirectory);
         }
      }
      catch(e)
      {
      }
}
function SetEnabled()
{
  	// Forcing parameters maps the following types
	if (window.external.FindSymbol("SIMPLE_TYPE")		||
		window.external.FindSymbol("MODIFIER_TYPE")		||
		window.external.FindSymbol("ATMOSPHERIC_TYPE")	||
		window.external.FindSymbol("MATERIAL_TYPE")		||
		window.external.FindSymbol("RENDER_EFFECT_TYPE")||
		window.external.FindSymbol("TEX_TYPE")			||
		window.external.FindSymbol("SHADOW_TYPE")		||
		window.external.FindSymbol("SKIN_GIZMO_TYPE")	||
		window.external.FindSymbol("MANIP_TYPE")		||
		window.external.FindSymbol("UI_BY_MAX")) 
	{
  		PARAMMAP_CHECKBOX.checked  = true;
  		PARAMMAP_CHECKBOX.disabled = true;
	} 
	else if (window.external.FindSymbol("STATIC_TYPE") ||
  			window.external.FindSymbol("IMAGE_FILTER_COMPOSITOR_TYPE") ||
			window.external.FindSymbol("GUP_TYPE") ||
			window.external.FindSymbol("IK_TYPE") ||
			window.external.FindSymbol("COLPICK_TYPE") ||
			window.external.FindSymbol("FILE_EXPORT_3DXI_TYPE") ||
			window.external.FindSymbol("FILE_EXPORT_TYPE") ||
  			window.external.FindSymbol("FILE_IMPORT_TYPE")) 
  	{
		window.external.AddSymbol("NON_ANIM_TYPE", true);
  		PARAMMAP_CHECKBOX.checked  = false;
  		PARAMMAP_CHECKBOX.disabled = true;
  	}
  	else 
  	{
  		PARAMMAP_CHECKBOX.disabled = false;
  	}
  	
	if(window.external.FindSymbol("MODIFIER_TYPE"))
	{
		EXTCHANNEL_CHECKBOX.disabled = false;
	}
	else
	{
		EXTCHANNEL_CHECKBOX.disabled = true;
	}
	
	ExtractFromDefaults();

}

function ExtractFromDefaults()
{
	// Michaelson: defaults are now loaded from userDefaults.js (rendered from template)
	var sdkPath = window.external.FindSymbol("SDKPATH"); //getINIValue("wizard paths", "SDKPATH");
	MAXSDKPATH_TEXTBOX.value = sdkPath;
	
	var plugPath = window.external.FindSymbol("PLGPATH"); //getINIValue("wizard paths", "PLGPATH");
	PLUGPATH_TEXTBOX.value = plugPath;
	
	var exePath = window.external.FindSymbol("EXEPATH"); //getINIValue("wizard paths", "EXEPATH");
	EXEPATH_TEXTBOX.value = exePath;
}

function WriteToIniFile()
{
	// Writing .ini file 
	try
	{
		//var fso = new ActiveXObject("Scripting.FileSystemObject");
		var a; // = fso.CreateTextFile(iniPath,true);
	
		a.WriteLine("[wizard paths]");
	
		a.WriteLine(";SDK include path");
		a.WriteLine("SDKPATH=" + MAXSDKPATH_TEXTBOX.value);
	
		a.WriteLine(";Plugin output path");
		a.WriteLine("PLGPATH=" + PLUGPATH_TEXTBOX.value);
	
		a.WriteLine(";3ds max exe path");
		a.WriteLine("EXEPATH=" + EXEPATH_TEXTBOX.value);
		a.Close();
	}
	catch(e) 
	{
		// let it go.
	}
}

function getINIValue(header, key) 
{
	// Reading .ini file 
	var bFound = false, i = -1, out = "", s = "", fso, f, t;
	try 
	{
		fso = 0; //new ActiveXObject("Scripting.FileSystemObject");
		
		f = fso.opentextfile(iniPath, 1, false);
		while (!f.AtEndOfStream) 
		{
			s = f.readline();
		
			if (s.toLowerCase() == "\[" + header.toLowerCase() + "\]") 
			{
				bFound = true;
			}
			if (bFound) 
			{
				i = s.indexOf("=");
				if (i > -1) 
				{
					t = s.substring(0, i);
					if (key.toLowerCase() == t.toLowerCase()) 
					{
						out = s.substring(i + 1, s.length);
						break;
					}
				}
			}
		}
		f.close();
		f = null;
		fso = null;
	}
	catch(e) 
	{
		// let it go.
	}
	return out;
}

// This is an example of a function which initializes the page
//
function InitDocument(document)
{
	setDirection();
	
	if (window.external.FindSymbol('DOCUMENT_FIRST_LOAD'))
	{
		// This function sets the default symbols based 
		// on the values specified in the SYMBOL tags above
		//
		window.external.SetDefaults(document);
	}

	// Load the document and initialize the controls 
	// with the appropriate symbol values
	//
	window.external.Load(document);
}

function HandleNav()
{
	var hybridConfig = false; 
	/*long ec; 
	CString buf;
	HKEY hKey; 
	DWORD dwDisposition;*/

	// TODO: Set template variables based on the dialog's data.
	window.external.AddSymbol("SDKPATH", MAXSDKPATH_TEXTBOX.value);
	window.external.AddSymbol("PLGPATH", PLUGPATH_TEXTBOX.value);
	window.external.AddSymbol("EXEPATH", EXEPATH_TEXTBOX.value);
	window.external.AddSymbol("ADD_COMMENTS", true);
	// Store path names in .ini
	// Michaelson: no longer used, defaults are held in userDefaults.js (rendered from template)
	//WriteToIniFile();

	/*if(ADDCOMMENTS_CHECKBOX.checked) 
	{
		window.external.AddSymbol("ADD_COMMENTS", true);
	}
	else
	{
		window.external.RemoveSymbol("ADD_COMMENTS");
	}*/
	
	// Not sure where the UI for this is in original wizard
	if(hybridConfig)
	{
		window.external.AddSymbol("HYBCONFIG", true);
	}
	else
	{
		window.external.RemoveSymbol("HYBCONFIG");
	}
	
	if(EXTCHANNEL_CHECKBOX.checked)
	{
		window.external.AddSymbol("EXTENSION",true);
	}
	else
	{
		window.external.RemoveSymbol("EXTENSION");
	}
	
	var tex = window.external.FindSymbol("TEX_TYPE");
	var mtl = window.external.FindSymbol("MATERIAL_TYPE");
	
	if(PARAMMAP_CHECKBOX.checked) // Set the necessary keys if implementing param maps
	{
		window.external.AddSymbol("PARAM_MAPS",	true);
		window.external.AddSymbol("PARAM_NAME",	"GetString(IDS_PARAMS)");
		
		// Should refer to SimpleObject2::pblock2 instead of old SimpleObject::pblock
		if (window.external.FindSymbol("SIMPLE_TYPE") && (window.external.FindSymbol("PROCEDURAL_OBJECT_TYPE") || window.external.FindSymbol("MODIFIER_TYPE")))
		{
			window.external.AddSymbol("PBLOCK",	"pblock2");
			window.external.AddSymbol("SIMPLE_OBJ", true);
		}
		else
			window.external.AddSymbol("PBLOCK",	"pblock");
		
		if (tex) // if a texture map plugin
		{
			window.external.AddSymbol("NUM_REFS", "2+NSUBTEX");
			window.external.AddSymbol("PB_REF", "1");
		}
		else if(mtl) 
		{
			window.external.AddSymbol("NUM_REFS","1+NSUBMTL");
			window.external.AddSymbol("PB_REF", "0");		
		}
		else 
		{
			window.external.AddSymbol("NUM_REFS","1");
			window.external.AddSymbol("PB_REF",	"0");
		}
	}
	else
	{
		window.external.RemoveSymbol("PARAM_MAPS");
		window.external.AddSymbol("PBLOCK", "NULL");
		window.external.AddSymbol("PARAM_NAME", "_T(\"\")");
		
		if (tex) // If a texture map plugin
		{
			window.external.AddSymbol("NUM_REFS", "1+NSUBTEX");
		}
		else if(mtl) 
		{
			window.external.AddSymbol("NUM_REFS", "NSUBMTL");
		}
		else
		{
			window.external.AddSymbol("NUM_REFS", "0");	
		}
	}
}

// If the wizard has more than 1 page, this 
// function will browse to the page specified
//
function Next(document, linkto)
{	
	HandleNav();
	window.external.Next(document, linkto);
}

// This is an example of a function which
// gets called when the user clicks on 'Finish'
//
function OnFinish(document)
{
	HandleNav();
	OnWizFinish(document);
}

		</SCRIPT>
		<SCRIPT ID="INCLUDE_SCRIPT" LANGUAGE="JSCRIPT"></SCRIPT>
		<SCRIPT language="JSCRIPT" id="INCLUDE_COMMON"></SCRIPT>
		<!-- 
Common.js is a script file which contains the helper functions 
used by the wizards.  Include this line if you want to
call these functions from your html scripts.
//-->

<SCRIPT>
	var strPath = window.external.FindSymbol("PRODUCT_INSTALLATION_DIR");
	strPath += "VCWizards/";
	strPath += window.external.GetHostLocale();
	var strScriptPath = strPath + "/Script.js";
	var strCommonPath = strPath + "/Common.js";
	document.scripts("INCLUDE_SCRIPT").src = strScriptPath;
	document.scripts("INCLUDE_COMMON").src = strCommonPath;
</SCRIPT>
